feat(rewards): add Perps Trading campaign participant outcome#29648
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
e03edf7 to
654b02c
Compare
5c8c9bc to
83a1a6f
Compare
- Add `PERPS_TRADING` to `CampaignType` enum - Add `PerpsTradingCampaignParticipantOutcomeDto` type - Add `getPerpsTradingCampaignParticipantOutcome` to data service, controller (10 min cache), action types, and messenger - Add `usePerpsTradingCampaignParticipantOutcome` hook for fetching outcome - Add `usePerpsTradingCampaignEndedOutcomeToast` hook: shows winner toast (→ winning view) or participant_finalized toast (→ campaigns) - Add `PerpsTradingCampaignWinningView` screen: displays rank and verification code, with copy/mail actions - Add `formatOrdinalRank` utility to formatUtils - Wire navigator with new screen and toast hook - Add en.json strings for toast and winning view Co-authored-by: VGR-GIT <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> fix(rewards): use COPY_WINNER_VERIFICATION_CODE metric for winning view copy action Replace the incorrect COPY_REFERRAL_CODE button type with a dedicated COPY_WINNER_VERIFICATION_CODE value in the analytics event fired when a user copies their verification code on the Perps Trading winning view. Co-authored-by: VGR-GIT <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> Reduce duplication Add test coverage Fix lint
83a1a6f to
2ab5074
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #29648 +/- ##
===========================================
- Coverage 81.86% 56.56% -25.30%
===========================================
Files 5255 5296 +41
Lines 138980 140196 +1216
Branches 31518 31878 +360
===========================================
- Hits 113774 79307 -34467
- Misses 17465 54305 +36840
+ Partials 7741 6584 -1157 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
No E2E tests exist specifically for the Rewards feature (no tests/smoke/rewards directory), so these tags cover the closest related test suites. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 464bd29. Configure here.
| } | ||
|
|
||
| const showEndedStats = | ||
| isComplete && !isParticipantStatusLoading && (!isOptedIn || !hasPosition); |
There was a problem hiding this comment.
Ended stats flash during position loading for opted-in users
Medium Severity
The showEndedStats condition doesn't check isPositionLoading for opted-in users, causing a brief layout flash. When an opted-in user visits a completed campaign and their leaderboard position is still loading, hasPosition is false, making showCampaignEndedStats true. Once position loads, showStatsSummarySection takes over and showCampaignEndedStats flips to false. The showHowItWorksSection calculation correctly guards against this with !isPositionLoading, but showEndedStats does not.
Reviewed by Cursor Bugbot for commit 464bd29. Configure here.
|





Description
Adds Perps Trading campaign outcome support to the Rewards stack, mirroring the Ondo GM outcome pattern.
After a Perps Trading campaign ends, opted-in participants can query
GET /perps-trading/:campaignId/outcome/meto learn whether they won. This PR wires that endpoint into the mobile app end-to-end:winnerVerificationCode+pendingstatus) see a toast → tap →PerpsTradingCampaignWinningViewshowing their rank, verification code (copy or email to claim prize)finalizedstatus, no code) see a toast → tap → campaigns viewChangelog
CHANGELOG entry: null
Related issues
Fixes: rwds-perps-trading-outcome
Changes
types.tsCampaignType.PERPS_TRADING,PerpsTradingCampaignParticipantOutcomeDtorewards-data-service.tsgetPerpsTradingCampaignParticipantOutcome()→GET /perps-trading/:campaignId/outcome/meRewardsController.tsusePerpsTradingCampaignParticipantOutcome.tsusePerpsTradingCampaignEndedOutcomeToast.tswinner_pending→ winning view;participant_finalized→ campaignsPerpsTradingCampaignWinningView.tsxformatUtils.tsformatOrdinalRank()(1st/2nd/3rd…)en.jsonManual testing steps
Screenshots/Recordings
Before
No Perps Trading outcome UI.
After
(to be added — requires a completed Perps Trading campaign with backend data)
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds new post-campaign outcome UI/UX (toasts, auto-navigation, new routes/screens) that can affect user navigation and state gating across Rewards; issues would mainly surface as incorrect redirects or missing banners/toasts.
Overview
Adds a shared
CampaignWinningViewand wires both Ondo and Perps campaigns to use it for winner verification-code display (copy + mailto) with a consistent fallback when no code is available.Introduces a generic
useCampaignParticipantOutcome+useCampaignOutcomeToastpattern, then adds Perps Trading support viausePerpsTradingCampaignParticipantOutcomeandusePerpsTradingCampaignEndedOutcomeToast, mounting these toasts onRewardsDashboardandCampaignsView.Expands Perps Trading end-of-campaign UX: new
PerpsTradingCampaignWinningViewroute/screen, outcome banners on details/stats (with one-time session auto-navigation for pending winners), an ended-campaign stats panel, and tweaks to completed-campaign stat presentation (hide pending tag; hide volume/margin once complete). Also consolidates outcome banner locale keys and generalizesCampaignOutcomeBannerusage across campaigns.Reviewed by Cursor Bugbot for commit 464bd29. Bugbot is set up for automated code reviews on this repo. Configure here.